/*************************************************************
 * @file mg_can.h
 * @author MicroOrange
 * @brief 
 * @date 2023/2/21
 *************************************************************/

#ifndef LS_ARM_MG_CAN_H
#define LS_ARM_MG_CAN_H

#include "can.h"

#define FEEDBACK_ID_BASE      0x205
#define CAN_CONTROL_ID_BASE   0x1ff
#define CAN_CONTROL_ID_EXTEND 0x2ff
#define MOTOR_MAX_NUM         7

typedef struct
{
    uint16_t can_id;
    int16_t  set_voltage;
    uint16_t rotor_angle;
    int16_t  rotor_speed;
    int16_t  torque_current;
    uint8_t  temp;
}moto_info_t;

extern moto_info_t motor_info[MOTOR_MAX_NUM];

void can_user_init(CAN_HandleTypeDef* tar_can);
void set_motor_voltage(uint8_t id_range, int16_t v1, int16_t v2, int16_t v3, int16_t v4);
#endif //LS_ARM_MG_CAN_H
